﻿<Window x:Class="XPSConverter.XPSConverterWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Data="clr-namespace:System.Windows.Data;assembly=PresentationFramework" Title="XPS Converter" Height="350" Width="280" WindowStartupLocation="CenterScreen" x:Name="root" >
    <Window.Resources>
        <DataTemplate x:Key="PaperSizeTemplate">
            <!-- we bind to a tuple of name, size-->
            <Label FontSize="12" FontWeight="Bold" Margin="2,2,2,2" 
                   Content="{Data:Binding Path=Item1, FallbackValue=NoName}">              
            </Label>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <GroupBox Header="Paper Size" Name="PaperSizeBox" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0" Grid.Column="0">
            <Grid>
                <ListBox HorizontalAlignment="Stretch" Name="PaperSize" VerticalAlignment="Stretch" 
                         ItemsSource="{Binding  ElementName=root,Path=PaperSizes}" 
                         ItemTemplate="{DynamicResource PaperSizeTemplate}"/>
            </Grid>
        </GroupBox>
        <GroupBox Header="File Type" HorizontalAlignment="Stretch" Name="OutputTypeBox" VerticalAlignment="Stretch" Grid.Row="1">
            <Grid>
                <ListBox HorizontalAlignment="Stretch" Name="FileType" VerticalAlignment="Stretch"
                         ItemsSource="{Binding  ElementName=root,Path=FileTypes}" />                
            </Grid>
        </GroupBox>
        <Button Content="Select XPS" FontWeight="ExtraBold" FontSize="20" Grid.Row="2" Name="Open" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Click="OpenClick" />
    </Grid>
</Window>
